package gameAppLayer;

import java.util.ArrayList;

import com.jme3.collision.MotionAllowedListener;
import com.jme3.input.InputManager;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.AbstractControl;

public abstract class AbstractRealCamera extends AbstractControl { //implements IRealCamera {
	
	protected Camera cam;
	protected float moveSpeed = 1f;
	protected float zoomSpeed = 1f;
		
	protected MotionAllowedListener motionAllowed;		
	
//	protected ArrayList<ICameraWatcher> watcherList = new ArrayList<ICameraWatcher>();
	
	public void setCamera(Camera cam) {
		this.cam = cam;		
	}
	
	public Camera getCamera() {
		return this.cam;
	}
	
	public void setMotionAllowedListener(MotionAllowedListener listener) {
    	this.motionAllowed = listener;
    }
    
    public void setMoveSpeed(float moveSpeed) {
    	this.moveSpeed = moveSpeed;
    }
    
    public void setZoomSpeed(float zoomSpeed) {
    	this.zoomSpeed = zoomSpeed;
    }
    
//    public void setEnabled(boolean enable) {
//    	enabled = enable;
//    }
//    
//    public boolean isEnabled() {
//    	return enabled;
//    }
    
    public Vector3f getLocation() {
    	return cam.getLocation();
    }
    
    protected void updateSpatialLocation() {
    	float x = cam.getLocation().x;
    	float y = cam.getLocation().y;
    	float z = cam.getLocation().z;
    	this.spatial.setLocalTranslation(x, y, z);
    }
    
    
//    public void setSpatial(Spatial spatial) {
//    	this.spatial = spatial;
//    	
//    	updateSpatialLocation();
//    }
    
//    public void addCameraWatcher(ICameraWatcher watcher) {
//		watcherList.add(watcher);
//		watcher.setCamera(this);
//	}
//	
//	public void removeCameraWatchers() {
//		watcherList.clear();
//	}
    
    public abstract void registerInputs(InputManager inputManager);
    
    protected abstract void zoomCamera(float value);
    
    protected abstract void moveCamera(float value, boolean sideways);
    
   
}
